home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE11 / FILES / TFDD1U.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-05-31  |  1.4 KB  |  70 lines

  1. unit Tfdd1u;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, ExtCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     Edit1: TEdit;
  13.     Button2: TButton;
  14.     Timer1: TTimer;
  15.     procedure FormCreate(Sender: TObject);
  16.     procedure Button1Click(Sender: TObject);
  17.     procedure Button2Click(Sender: TObject);
  18.   private
  19.     { Private declarations }
  20.   public
  21.   end;
  22.  
  23. var
  24.   Form1: TForm1;
  25.  
  26. implementation
  27.  
  28. uses
  29.   RWEditU;
  30.  
  31. {$R *.DFM}
  32.  
  33. procedure TForm1.FormCreate(Sender: TObject);
  34. begin
  35.   { Can't do this in the TFDD unit initialisation as it relies }
  36.   { on an object in the form that only gets created after }
  37.   { initialisation sections have finished executing }
  38.   AssignRWEdit(Input, Edit1);
  39.   Reset(Input);
  40.   AssignRWEdit(Output, Edit1);
  41.   Rewrite(Output);
  42. end;
  43.  
  44. procedure TForm1.Button1Click(Sender: TObject);
  45. var
  46.   D1, D2: Double;
  47. begin
  48. {$ifdef OnePossibility}
  49.   ReadLn(D1, D2);
  50. {$else}
  51.   Read(D1);
  52.   Read(D2);
  53.   ReadLn;
  54. {$endif}
  55.   ShowMessage(Format('First value: %f', [D1]));
  56.   ShowMessage(Format('Second value: %f', [D2]));
  57.   Write('Type something in me and push the 2nd button');
  58. end;
  59.  
  60. procedure TForm1.Button2Click(Sender: TObject);
  61. var
  62.   S: String;
  63. begin
  64.   ReadLn(S);
  65.   ShowMessage(Format('You wrote: %s', [S]));
  66.   Write('Game over');
  67. end;
  68.  
  69. end.
  70.